Apparently, tis the season to be writing your own
Last.fm plugin.
So
here is mine.
I finally got fed up with finding and causing bugs in mpdscribble (I am
a bad sponsor!) it s written in C with libsoup, blah blah, can t stand
C, and so I revived the MPD pseudo-listener I had started on as a
replacement for that awful orphaned cacheless one-off we were all using
before mpdscribble. I also fixed a few issues that were bugging me, like
failing to detect restarts and tag changes. Not wanting to muddy up any
of that logic with HTTP gar, I decided to write a separate program to
queue, cache and send along song submissions.
They re two or three hundred lines of Python each, and single-threaded
(yes, that means child writers blocking and hanging around if the
network code is in the middle of timing out or backing off. Deal with
it! This is UNIX). I m pretty happy with the design, although the
implementation is still very rough. This also mimics the model they want
to
move to for player plugins in general, which is good, because it
will be less work for me to implement version 2.0 of the protocol once
that is finalized.
Additionally, I was able to find a more satisfying way to solve the
disconnected-CD-player problem than my previous dreadful method of
either using a few kludgey scripts to frob around in my primary plugin s
cache or dealing with using cdscrobbler and having to be very careful
about one plugin not stepping on the other s toes and invalidating my
backlog. So this is the second example program included.
(Oh yes, that part uses the Python bindings for MusicBrainz. MB is
awesome. The Python bindings are hideous, however straight port of the
C++ API. I d probably be better off just dumping the RDF into a real RDF
implementation and doing my own cross-referencing, instead of prying it
out piecemeal with select queries and non-polymorphic getters and
all the other absolute nonsense you have to deal with when writing in a
language without high-level data types or garbage collection. But
regardless of implementation woes, this has kept me close to the MB
metadata for my favorite CDs, and so I ve been busy all week entering
and voting on mods (and doing research to justify my changes), which is
very satisfying. I have yet to begin the gargantuan task of adding MB
tags to my Ogg collection (I know, this is really just a matter of
babysitting tp_tagger, but I ve got some work cut out for me to even get
to that point).)
And of course, once this becomes less prototypey, anyone who likes it
can knock all the networking code out of their plugin and use it as
their system service . Perhaps if I m agile enough this can become
official code! It is at least a mootable proof-of-concept that UNIX
systems don t necessarily
need a heavyweight libscrobbler to abstract
the service stuff out of the player plugin. I won t get my hopes up
though.
Still a bit unsure about the name. Theoretically it seems the
service
(you know, the thing we pay money to if we like it) should be Last.fm,
while the software and protocols should still be Audioscrobbler, but the
distinction does not seem to be drawn very clearly in practice. With the
analogous situation of livejournal vs. ljcom you had a grokkable
technical delineation (different repositories) as well as other widely
used installations besides ljcom (DeadJournal, etc). I really can t see
there ever being a competing installation of Audioscrobbler, because
licensing the streamables is a formidable investment hurdle, and there s
a negative market effect (also, the web site is not open source). But I
am also bored of just sticking scrobble onto something else, so I
wanted to grab sticking last onto something else before it got old. I
haven t the faintest clue what makes me prefer whimsical names for some
projects and prosaic ones for others.
Note to actual MPD users (all, like, 5 of you):
the stuff
in the package will not handshake at the moment, as I have not yet
gotten Russ to bless the client ID I made up. Will try to catch him
tomorrow. Or later today I suppose. It s ready to go now.
Next up: Because it s either this or Sound Juicer, I think perhaps it s
time to bid adieu to abcde and write a MusicBrainz plugin for jack (jack
is nice enough, I just haven t had a truly compelling reason to switch,
and there have always been lots of good eyeballs on abcde). FreeDB
delenda est.